package com.CST.controller.cb;


import com.CST.annotation.ResultObjectAnnotation;
import com.CST.common.constant.DmlTypeConstant;
import com.CST.entity.cb.BdEnum;
import com.CST.service.cb.IBdEnumService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ly
 * @since 2021-09-23
 */
@Api(tags = {"基础数据"})
@RestController
@RequestMapping("/bdEnum")

public class BdEnumController {

    @Autowired
    private IBdEnumService targetService;


    @PostMapping("/saveOrUpdate")
    @ApiOperation("新建或编辑")
    @ResultObjectAnnotation(value = DmlTypeConstant.INSERT, successMessage = "新建或编辑成功!", errorMessage = "新建或编辑失败!")
    public Object saveOrUpdate(@RequestBody BdEnum BdEnum) {
        return targetService.saveOrUpdate(BdEnum);
    }


    @GetMapping("/getById/{id}")
    @ApiOperation("查看")
    @ResultObjectAnnotation(DmlTypeConstant.SELECT)
    public Object getById(@PathVariable String id) {
        return targetService.getById(id);
    }


    @DeleteMapping("/delete/{ids}")
    @ApiOperation("删除")
    @ResultObjectAnnotation(DmlTypeConstant.DELETE)
    public Object delete(@PathVariable List<String> ids) {
        return targetService.removeByIds(ids);
    }


}

